package cdu.sl.aichatdemo.config;

import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatOptions;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @Description
 * @Author sunlin5@asiainfo.com
 * @Date 2025/8/29
 * @Version 1.0
 */
@Configuration
public class ChatClientConfig {
    private static final String DEFAULT_PROMPT = "你是一个博学的智能聊天助手，请根据用户提问回答！";


    @Bean
    public ChatClient dashScopeChatClient(ChatClient.Builder builder) {
        return builder.defaultSystem(DEFAULT_PROMPT)
                .defaultAdvisors(new SimpleLoggerAdvisor())
                .defaultOptions(
                        DashScopeChatOptions.builder()
                                .withTopP(0.7)
                                .withEnableThinking(true)
                                .build()
                )
                .build();
    }


}
